<div>
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-body">
                <div class="col-md-1 align-right">
                    <button type="submit" onclick="javascript:search();return false;" class="btn btn-primary"><i class="fa fa-search"></i> 筛选</button>
                </div>
                <div class="col-md-4 align-right">
                    <div class="input-group input-large custom-date-range" data-date="2012-02-12"
                         data-date-format="yyyy-mm-dd">
                        <input type="text" class="laydate-icon form-control flayer-date " id="start_time"
                               value="<?php echo $this->start_time; ?>" name="from" placeholder="开始时间">
                        <span class="input-group-addon">To</span>
                        <input type="text" class=" laydate-icon form-control layer-date " id="end_time"
                               value="<?php echo $this->end_time; ?>" name="to" placeholder="结束时间">
                    </div>
                </div>
                <input hidden id="table_name" value="<?php echo $this->table_name ?>">
            </div>
            <div class="panel-body">
                <section id="no-more-tables">
                    <table class="table table-bordered table-striped table-condensed cf">
                        <thead class="cf">
                        <tr>
                            <td>员工名称</td>
                            <td>操作</td>
                            <td>更新内容</td>
                            <td>创建时间</td>
                            <td>创建ip</td></tr>
                        </thead>
                        <tbody>
                        <?php foreach ($this->log_list as $log_info) { ?>
                            <tr>
                                <td dat-title="员工名称"><?php echo $log_info['staff_name'] ?></td>
                                <td dat-title="操作"><?php echo $log_info['log_memo'] ?></td>
                                <td dat-title="更新内容"> <a class="content" content='<?php echo $log_info['change_html'] ?>' data-toggle="modal" href="#myModal">查看改动</a></td>
                                <td dat-title="创建时间"><?php echo $log_info['create_time'] ?></td>
                                <td dat-title="创建ip"><?php echo long2ip($log_info['create_ip']) ?></td>
                            </tr>
                        <?php } ?>
                        </tbody>
                    </table>
                    <?php echo $this->page ?>
                </section>
            </div>
        </div>
    </div>

    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div style="background-color:#e9552e;padding:5px 0;text-align:center;color:white">
                    <h5>更新内容 </h5>
                </div>
                <div class="modal-body">
                    <div class="panel-body modal_content">

                    </div>
                </div>
                <div class="modal-footer" style="text-align: center;" id="mo">
                    <button class="btn btn-success sure-save " type="button"  style="background-color:#e9552e;border-color:#e9552e;"  data-dismiss="modal" aria-hidden="true">确认</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $('.content').click(function () {
        var content = $(this).attr('content');
        $('.modal_content').empty();
        $('.modal_content').html(content);
    });
    function search() {
        var query_string = getSearchString();
        if (query_string !== false) {
            window.location.href = '/setting/log-detail?' + query_string;
        }
    }

    laydate({
        elem: "#start_time",
        format: 'YYYY-MM-DD hh:mm:ss', //日期格式
        istime: true, //是否开启时间选择
        event: "focus"
    });
    laydate({
        elem: "#end_time",
        format: 'YYYY-MM-DD hh:mm:ss', //日期格式
        istime: true, //是否开启时间选择
        event: "focus"
    });

    function getSearchString() {
        var start_time = $('#start_time').val();
        var end_time = $('#end_time').val();
        var table_name = $("#table_name").val();
        if (start_time > end_time) {
            layer.alert('对不起，开始时间不能大于结束时间');
            return false;
        }
        var query_string = '?';
        if (start_time != '') {
            query_string += '&start_time=' + start_time;
        }
        if (end_time != '') {
            query_string += '&end_time=' + end_time;
        }
        if (table_name != '') {
            query_string += '&table_name=' + table_name;
        }
        query_string = query_string.substr(2, query_string.length);
        return query_string;
    }
</script>